package com.bw.live.ui

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.bw.common.BaseApplication
import com.bw.common.common.ConstantValue
import com.bw.common.utils.UserUtils
import com.bw.live.databinding.FragmentLiveBinding
import com.bw.mvicore.ui.BaseFragment


/**
 * @author:created by hahajing
 * 时间：2024/4/24 0024
 * 企鹅号:444511958
 * 描述:
 */
class LiveFragment:BaseFragment() {
    private lateinit var binding: FragmentLiveBinding
    override fun initEvent() {
        binding.tvLiveLive.setOnClickListener {
            val bundle = Bundle()
            bundle.putBoolean("isBoradcastr",true)
            val list= mutableListOf<String>()
            val user = UserUtils.getCurrentUserStr()
            list.add(user)
            //指定packagename
            list.add(ConstantValue.PACKAGE)
            //指定LiveActivity的action
            list.add(ConstantValue.LIVEACTIVITY_ACTION)

            BaseApplication.getWebSocket().sendMsg(list.joinToString())
            getBaseActivity().route(LiveActivity::class.java,bundle)
        }

        binding.tvLiveJoin.setOnClickListener {
            val bundle = Bundle()
            bundle.putBoolean("isBoradcastr",false)
            getBaseActivity().route(LiveActivity::class.java,bundle)
        }
    }

    override fun generateFragmentRootView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        binding = FragmentLiveBinding.inflate(inflater,container,false)
        return binding.root
    }

    override fun lazyLoad() {

    }


}